//
//  DataContrller.h
//  TestDemo
//
//  Created by 崔璨 on 2017/9/25.
//  Copyright © 2017年 cccc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BaseViewController.h"
#import "AFNetworking.h"
@interface DataContrller : NSObject

#pragma mark - Block

/**
 请求成功Block
 
 @param backDic 返回的字典
 */
typedef void(^successBackBlock)(NSDictionary *backDic);
@property (nonatomic, copy) successBackBlock requestSuccessBackBlock;

/**
 请求失败Block
 
 @param backErrorStr 返回的错误信息
 */
typedef void(^failBackBlock)(NSString *backErrorStr);
@property (nonatomic, copy) failBackBlock requestfailBackBlock;

/**
 上次图片进度Block

 @param progresFloat 进度Float
 */
typedef void(^uploadProgress)(CGFloat progresFloat);
@property (nonatomic, copy) uploadProgress ProgresBackBlock;

#pragma mark - 接口

/**
 Post请求
 
 @param urlStr 请求的Url
 @param paramDic 参数
 @param requestSuccessBackBlock 请求成功回调
 @param requestFailBackBlock 请求失败回调
 */
+(void)PostRequestUrl:(NSString *)urlStr
                Param:(NSDictionary *)paramDic
       requestSuccess:(successBackBlock)requestSuccessBackBlock
          requestFail:(failBackBlock)requestFailBackBlock;



/**
 Get请求
 
 @param urlStr 请求的Url
 @param paramDic 参数
 @param requestSuccessBackBlock 请求成功回调
 @param requestFailBackBlock 请求失败回调
 */
+(void)GetRequestUrl:(NSString *)urlStr
               Param:(NSDictionary *)paramDic
      requestSuccess:(successBackBlock)requestSuccessBackBlock
         requestFail:(failBackBlock)requestFailBackBlock;



/**
 上传图片

 @param urlStr 上传的Url
 @param image 上传的图片
 @param imageNameStr 图片命名
 @param paramDic 参数
 @param ProgresBackBlock 上传进度回调
 @param uploadSuccessBackBlock 上传成功回调
 @param uploadFailBackBlock 上传失败回调
 */
+(void)uploadImageUrl:(NSString *)urlStr
             andImage:(UIImage *)image
         andImageName:(NSString *)imageNameStr
             andParam:(NSDictionary *)paramDic
       uploadProgress:(uploadProgress)ProgresBackBlock
        uploadSuccess:(successBackBlock)uploadSuccessBackBlock
           uploadFail:(failBackBlock)uploadFailBackBlock;

@end
